package com.zhongkai.web.control.ticket;

import java.io.PrintWriter;
import java.io.Serializable;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.zhongkai.model.ticket.TDjWjccstz;
import com.zhongkai.service.ticket.info_without_taxService;
import com.zhongkai.tools.CheckWord;
import com.zhongkai.web.control.book.ParamType;

@Controller
public class info_without_taxControl extends ParamType{
	@Autowired
	private info_without_taxService infowithouttax;
	
	@RequestMapping(value="/system/ticket/info_without_taxSubmit.do",method = RequestMethod.POST)
	public String displayform(TDjWjccstz tdjwjccstz,HttpServletRequest request,HttpServletResponse response)throws Exception
	{
		Date current=new Date();
		PrintWriter out=response.getWriter();
		tdjwjccstz.setDjRq(current);
		if (current.getTime() < tdjwjccstz.getCcbfRq().getTime())
			out.write(CheckWord.showMsg("作废日期超出当前时间！","/system/ticket/info_without_tax_form.jsp?ccdjh="+tdjwjccstz.getCcdjh(),request));
		infowithouttax.insert(tdjwjccstz,request);
		out.write(CheckWord.showMsg("未缴纳车船事项通知单保存成功！","/system/search/unisearch.jsp?module=ticket/info_without_tax_form.jsp",request));
		return null;//"redirect:/system/ticket/info_without_tax_form.jsp?abc=abc";
	}
	
	@RequestMapping(value="/system/ticket/info_without_taxCancel.do",method = RequestMethod.POST)
	public String cancelform(TDjWjccstz tdjwjccstz,HttpServletRequest request,HttpServletResponse response) throws Exception
	{
		PrintWriter out=response.getWriter();
		infowithouttax.update(tdjwjccstz,request);
		out.write(CheckWord.showMsg("未缴纳车船事项通知单作废成功！","/system/search/unisearch.jsp?module=ticket/info_without_tax_form.jsp",request));
		return null;
	}
}
